package top.chmin.project.cloud.common.column.code.auto;

// field import auto
// #bind.field.id#

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import top.chmin.project.cloud.common.entity.*;

/**
 * chmin
 * 2023-12-27 19:40:30
 * cloud-builder
 */
@Getter
@Setter
@Accessors(chain = true)
public class ColumnCode extends Model {

    // field auto
// #bind.field.fieldCode#
    // 属性编码
    private String fieldCode;
// $bind.field.fieldCode$

    // #bind.field.codeName#
    // 编码模板名称
    private String codeName;
// $bind.field.codeName$


    @Override
    public ColumnCodeEPC getPreCondition() {
        return new ColumnCodeEPC();
    }

    public class ColumnCodeEPC extends PreCondition {
        private ColumnCodeEPC() {
        }

        private ColumnCodeEPC(ColumnCodeEPC parent) {
            super(parent);
        }

        public ColumnCodeEPC forUpdate() {
            addUpdateSql("update_time = ?", updateTime);
            addUpdateSql("update_by = ?", updateBy);
// field update auto
// #bind.field.fieldCode#
            addUpdateSql("field_code = ?", fieldCode);
// $bind.field.fieldCode$

// #bind.field.codeName#
            addUpdateSql("code_name = ?", codeName);
// $bind.field.codeName$

            type = "UPDATE";
            return this;
        }

        public ColumnCodeEPC forDelete() {
            type = "DELETE";
            return this;
        }

        public ColumnCodeEPC forCount() {
            type = "COUNT";
            return this;
        }

        public ColumnCodeEPC sub() {
            return new ColumnCodeEPC(this);
        }

        public ColumnCodeEPC complete(boolean and) {
            finish(and);
            return parent == null ? this : (ColumnCodeEPC) parent;
        }

        public ColumnCodeFPC toFlex() {
            ColumnCodeFPC flex = new ColumnCodeFPC();
            flex.setUpdateSqlList(updateSqlList);
            flex.setUpdateValueList(updateValueList);
            flex.setSqlList(sqlList);
            flex.setValueList(valueList);
            flex.setType(type);
            return flex;
        }

        public Condition toCondition() {
            return toCondition(ColumnCode.class, "cm_column_code");
        }

        // field epc auto
// #bind.field.id#
        public Id id() {
            return new Id();
        }

        // #bind.field.createBy#
        public CreateBy createBy() {
            return new CreateBy();
        }
// $bind.field.id$

        // #bind.field.updateBy#
        public UpdateBy updateBy() {
            return new UpdateBy();
        }

        // #bind.field.createTime#
        public CreateTime createTime() {
            return new CreateTime();
        }
// $bind.field.createBy$

        // #bind.field.updateTime#
        public UpdateTime updateTime() {
            return new UpdateTime();
        }

        // #bind.field.fieldCode#
        public FieldCode fieldCode() {
            return new FieldCode();
        }
// $bind.field.updateBy$

        // #bind.field.codeName#
        public CodeName codeName() {
            return new CodeName();
        }

        public class Id extends LongEPCField<ColumnCodeEPC> {
            private Id() {
                super(ColumnCodeEPC.this, "id", id);
            }
        }
// $bind.field.createTime$

        public class CreateBy extends StringEPCField<ColumnCodeEPC> {
            private CreateBy() {
                super(ColumnCodeEPC.this, "create_by", createBy);
            }
        }

        public class UpdateBy extends StringEPCField<ColumnCodeEPC> {
            private UpdateBy() {
                super(ColumnCodeEPC.this, "update_by", updateBy);
            }
        }
// $bind.field.updateTime$

        public class CreateTime extends LocalDateTimeEPCField<ColumnCodeEPC> {
            private CreateTime() {
                super(ColumnCodeEPC.this, "create_time", createTime);
            }
        }

        public class UpdateTime extends LocalDateTimeEPCField<ColumnCodeEPC> {
            private UpdateTime() {
                super(ColumnCodeEPC.this, "update_time", updateTime);
            }
        }
// $bind.field.fieldCode$

        public class FieldCode extends StringEPCField<ColumnCodeEPC> {
            private FieldCode() {
                super(ColumnCodeEPC.this, "field_code", fieldCode);
            }
        }

        public class CodeName extends StringEPCField<ColumnCodeEPC> {
            private CodeName() {
                super(ColumnCodeEPC.this, "code_name", codeName);
            }
        }
// $bind.field.codeName$

    }
}
